﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MagicBag.CRM.Model;
using MagicBag.CRM.IDAL;

namespace MagicBag.CRM.BLL
{
    public class DepartmentBLL
    {
        //创建数据访问对象
        private static readonly IDepartment departmentDAL = DALFactory.DataAccess.CreateDepartment();

        public DepartmentBLL()
        { }

        public IList<Department> GetDepartments()
        {
            return departmentDAL.GetDepartments();
        }

        public int Insert(Department dept)
        {
            return departmentDAL.Insert(dept);
        }

        public int Delete(int id)
        {
            return departmentDAL.Delete(id);
        }

        public int Update(Department dept)
        {
            return departmentDAL.Update(dept);
        }

        public IList<Department> GetChildrens(Department dept)
        {
            return departmentDAL.GetChildrens(dept);
        }

        public IList<Department> GetDepartmentsByLevel(int level)
        {
            return departmentDAL.GetDepartmentsByLevel(level);
        }
    }
}
